package com.example;

import javax.persistence.*;

@NamedStoredProcedureQuery(
        name = "myPersons",
        procedureName = "get_person",
        resultClasses = Person.class,
        parameters = {
                @StoredProcedureParameter(mode = ParameterMode.REF_CURSOR,type = Void.class),
                @StoredProcedureParameter(mode = ParameterMode.IN,type = Integer.class)
        }
)

@NamedStoredProcedureQuery(
        name = "getAllPersons",
        procedureName = "get_all_persons",
        resultClasses = Person.class,
        parameters = {
                @StoredProcedureParameter(mode = ParameterMode.REF_CURSOR,type = Void.class)
        }
)
@Entity
@Table(name = "person")
public class Person {
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Integer id;
    @Column(name = "first_name")
    private String firstName;
    @Column(name = "last_name")
    private String lastName;
    private Integer phone;
    private String address;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public Integer getPhone() {
        return phone;
    }

    public void setPhone(Integer phone) {
        this.phone = phone;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }
}
